<template>
	<view class="Agreement">
		<view class="agree_box">
			<u-parse :content="agreeList[agreeIndex].content"></u-parse>
		</view>
	</view>
</template>

<script>
	import { getAbout} from '@/common/http.api.js';
	let that;
	export default {
		data() {
			return {
				agreeList: [
					{
						title: "隐私协议",
						content: ""
					},
					{
						title: "隐私协议",
						content: ""
					},
					{
						title: "用户协议",
						content: ""
					},
				],
				agreeIndex: 1
			}
		},
		onLoad(options) {
			that = this;
			if(options.type) {
				that.agreeIndex = options.type;
				uni.setNavigationBarTitle({
					title: that.agreeList[options.type].title
				})
			}
			that.getAbout();
		},
		methods: {
			getAbout() {
				getAbout()
					.then(res => {
						that.info = res.data;
						that.agreeList[0].content = res.data.privacy;
						that.agreeList[1].content = res.data.privacy;
						that.agreeList[2].content = res.data.agreement;
					})
					.catch(err => {
						uni.$u.toast(err.msg);
					});
			},
		}
	}
</script>

<style lang="scss" scoped>
	.Agreement{
		min-height: 100vh;
		background-color: #ffffff;
		.agree_box{
			padding: 20rpx 30rpx;
		}
	}
</style>
